<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		
		<style>
			
			div{
				
				width: 100px;
				height: 100px;
				background-color: red;
				
				margin: 2px;
			}
		</style>
	</head>
	<body>
		
		<div class="scott">aa</div>
		<div class="scott">bb</div>
		<div class="scott">cc</div>
		<div class="scott">dd</div>
		
		
		<input  type="button" id="deleteDivs" value="删除所有的divs" />
		
	</body>
	
	
	<script>
		
		
		document.getElementById('deleteDivs').onclick=function(){
			
			//1 找到所有.scott的div
			var divs = document.querySelectorAll('.scott');
			
			for(var index=0; index<=divs.length-1; index++){
				
				var div = divs[index];
				
				div.parentNode.removeChild(div);
			}
		}
		
		
	</script>
</html>
